package com.bw.sparksql1.job1
import java.util.Properties
import org.apache.log4j.{Level, Logger}
import org.apache.spark.sql.{DataFrame, SparkSession}

/**
  *
  */
object Job10 {
    def main(args: Array[String]): Unit = {
      Logger.getLogger("org").setLevel(Level.ERROR)
      val spark = SparkSession
        .builder()
        .master("local")
        .appName("Spark SQL basic example")
        .getOrCreate()
      val url="jdbc:mysql://hadoop5:3306/sqoop_db?serverTimezone=GMT";
      val properties = new Properties()
      properties.put("url",url)
      properties.put("user","root")
      properties.put("password","hadoop")
      val df: DataFrame = spark.read.jdbc(url,"customers",properties)
      df.show()
    }
}
